﻿using System;
using System.Xml;
using BfLib.Text;

namespace BfLib.Web.RSS
{
    public class RSSItemEnclosure
    {
        private string _url, _type;
        private Int64 _length;

        public RSSItemEnclosure(XmlNode node)
        {
            if (node == null)
                return;

            if (node.Attributes["url"] != null)
            {
                this._url = node.Attributes["url"].Value;
            }

            if (node.Attributes["length"] != null)
            {
                this._length = node.Attributes["length"].Value.ToIntDef(0);
            }

            if (node.Attributes["type"] != null)
            {
                this._type = node.Attributes["type"].Value;
            }
        }

        public string Url
        {
            get
            {
                return _url;
            }
        }

        public Int64 Length
        {
            get
            {
                return _length;
            }
        }

        public string Type
        {
            get
            {
                return _type;
            }
        }
    }
}
